import { BaseEntity } from "src/baseEntity";
import { System } from "src/system/system.entity";
import { UserSys } from "src/user/userSys.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";

export enum WorkType {
    长期 = "长期",
    短期 = "短期",
    实习 = "实习"
}
export enum RecordStatus {
    已入职 = "已入职",
    未入职 = "未入职"
}

@Entity("record")
export class Record extends BaseEntity {
    @ManyToOne(() => System)
    system: System

    @ManyToOne(() => UserSys)
    createUser: UserSys

    @OneToOne(() => UserSys)
    @JoinColumn()
    user: UserSys

    @Column({ comment: "上家公司名称", nullable: true })
    beforeCompany: string

    @Column({ comment: "工作时长", nullable: true })
    workTime: string

    @Column({ comment: "岗位", nullable: true })
    post: string

    @Column({ comment: "工资", nullable: true })
    salary: string

    @Column({ comment: "离职原因", nullable: true })
    reasonForLeave: string

    @Column({ comment: "能否接受夜班", default: false })
    isNight: boolean

    @Column({ comment: "期望工资", nullable: true })
    exceptSalary: string

    @Column({ comment: "工作类型", type: "enum", enum: WorkType, nullable: true })
    workType: WorkType

    @Column({ comment: "推荐人、邀请人", nullable: true })
    refernance: string
    //推荐人、邀请人
    // @ManyToOne(() => UserSys)
    // refernance: UserSys

    @Column({ comment: "人事建议", nullable: true })
    recommendation: string

    @Column({ comment: "通知入职", nullable: true })
    noticeEntry: boolean

    @Column({ comment: "安排入职时间", nullable: true, type: "timestamp" })
    entryTime: Date

    @Column({ comment: "状态", type: "enum", enum: RecordStatus, nullable: true })
    status: RecordStatus

    @Column({ comment: "备注", nullable: true })
    comment: string
}